home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 587 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.5 KB

  1. Path: life.ai.mit.edu!mib
  2. From: mib@gnu.ai.mit.edu (Michael I. Bushnell, p/BSG)
  3. Newsgroups: gnu.misc.discuss,comp.std.c
  4. Subject: Re: Coding Standards are ignorant
  5. Date: 18 Mar 1996 15:59:57 GMT
  6. Organization: Free Software Foundation, Cambridge, MA
  7. Message-ID: <MIB.96Mar18105957@gnu.ai.mit.edu>
  8. References: <4gum82$14v4@info4.rus.uni-stuttgart.de>
  9.     <MIB.96Mar15170902@gnu.ai.mit.edu> <wyraut5fqq.fsf@dns.bluesky.net>
  10.     <MIB.96Mar16174948@gnu.ai.mit.edu> <4ifq40$i87@sundog.tiac.net>
  11. NNTP-Posting-Host: duality.ai.mit.edu
  12. In-reply-to: stanr@tiac.net's message of 17 Mar 1996 01:32:48 GMT
  13.  
  14. In article <4ifq40$i87@sundog.tiac.net> stanr@tiac.net (Stan Ryckman) writes:
  15.  
  16.    (Added comp.std.c; those folks may skip to my question at the end)
  17.  
  18.    In article <MIB.96Mar16174948@gnu.ai.mit.edu>,
  19.    Michael I. Bushnell, p/BSG <mib@gnu.ai.mit.edu> wrote:
  20.  
  21.    [snip]
  22.  
  23.    [re Posix.2]
  24.    >You can't use printf to print any manifest integer type of unknown
  25.    >size, except for size_t.  (And that one only because ANSI went and
  26.    >added a special format code for size_t.)
  27.  
  28.    Can't you safely do this with casting to the (possibly unsigned) long
  29.    type?  e.g.,
  30.        pid_t whatever;
  31.        ...
  32.        printf( "%lu\n", (unsigned long) whatever);
  33.    A pain, but hardly a "can't".
  34.  
  35. You are not guaranteed that long is the widest integral type.  
  36.  
  37.    Oh, and what's that special ANSI format code for size_t?  I can't find
  38.    it in 4.9.6.1; was it added after printing or am I just blind?
  39.  
  40. I was wrong; there is not such ANSI format code.  The one I was
  41. thinking of is a GNU extension.
  42.  
  43. Michael
  44.